package com.aaa.dem1031.d04;

/**
 * @Author: whj
 * @Version 1.0
 * @Date: 2022/10/31  15:41
 */
public class Girl implements Runnable{
    private BankCard bankCard;
    public Girl(BankCard bankCard){
        this.bankCard=bankCard;
    }
    @Override
    public void run() {
        for (int i=0;i<10;i++){
            if(bankCard.getBalance()>=1000) {
                bankCard.setBalance(bankCard.getBalance() - 1000);
                System.out.println(Thread.currentThread().getName() + "取出1000,卡中余额:" + bankCard.getBalance());
            }else{
                System.out.println("卡中余额不足,抓紧时间存钱");
                i--;
            }
        }
    }
}
